IPMI远程管理那些事~ |
您所在的位置:网站首页 › bmc support bios设置 › IPMI远程管理那些事~ |
IPMI远程管理那些事~
原创
love_shift 2013-01-12 12:30:30 博主文章分类:Servers ©著作权 文章标签 ipmi 远程管理 文章分类 服务器 ©著作权归作者所有:来自51CTO博客作者love_shift的原创作品,请联系作者获取转载授权,否则将追究法律责任 1.IPMI及其原理介绍1.1 ipmi简介 IPMI是智能型平台管理接口(Intelligent Platform Management Interface)。用户可以利用IPMI监视服务器的物理特征,如温度、电压、电扇工作状态、电源供应以及机箱入侵等。IPMI最大的优势在于它是独立于CPU,BIOS和OS的,所以用户无论在开机还是关机的状态下,只要接通电源就可以实现对服务器的监控。IPMI是一种规范的标准,由美国英特尔、惠普(Hewlett-Packard)、NEC、美国戴尔电脑和SuperMicro等公司制定。最新的版本是IPMI2.0.1.2 ipmi可以实现的主要功能1. 可以在服务器通电(没有启动操作系统)情况下,对它进行远程管理:开机,关机,重启。2. 基于文本的控制台重定向,可以远程查看和修改bios设置,系统启动过程,登入系统等。3. 可以远程通过sol连接服务器,解决ssh服务无法访问,远程安装系统,查看系统启动故障等问题。4. 故障日志记录和 SNMP 警报发送,访问系统事件日志 (System Event Log ,SEL) 和传感器状况。注:目前,我们公司线上主要要求实现远程重启和远程屏幕两个功能。1.3 ipmi进行远程管理的必要条件(1) 服务器硬件本身提供对 IPMI的支持。目前惠普、戴尔和 NEC 等大多数厂商的服务器都支持 IPMI 2.0但并不是所有服务器都支持,所以应该先通过产品手册或在 BIOS 中确定服务器是否支持 IPMI,也就是说服务器在主板上要具有 BMC 等嵌入式的管理微控制器。(2)操作系统提供相应的 IPMI驱动。通过操作系统监控服务器自身的 IPMI信息时需要系统内核提供相应的支持,linux 系统通过内核对 OpenIPMI(IPMI驱动)的支持来提供对 IPMI的系统接口。(3) IPMI管理工具。本文选择的是 Linux 下的命令行方式的 IPMI平台管理工具 ipmitool。1.4 New for IPMI v2.0新版本的ipmi增加了一些新特性,以下列出几个比较重要的功能:1.Enhanced Authentication----RMCP+,key, sessions, au user //认证协议由RMCP到RMCP+,采用安全哈希算法2.VLAN Support ---IEEE 802.1q //vlan功能,局域网环境更加安全和方便管理3.Serial Over LAN (SOL) // 串口信息通过lan通信,实现远程屏幕功能4.Firmware Firewall //类似防火墙特性,可以设置一些安全策略,防止误操作之类1.5一些名词概念BMC:IPMI管理平台的核心控制器IPMB:IPMB 总线上连接着各个管理控制器,分别执行不同功能 ICMB: 在IPMB总线上,连接着一个ICMB桥,通过ICMB可以和远程的另一个管理平台通信SDR: (Sensor Data Record) 用于保存传感器的具体配置信息,如告警门限、事件触发是否允许等配置数据 SEL: (Sensor Event Log) 用于保存传感器产生的告警事件等数据 SMBus: BMC通过芯片上一对SMBus接口连接网络。1.6 IPMI管理方式IPMI管理的两种方式:本地管理和远程管理本地管理,是由应用层的工具,如ipmitool发送指令通过OS内核提供的接口(如下图1.1的①)和bmc进行通信。 应用软件-------------------------->OS内核接口-------------------------->bmc远程管理,则是通过网络(如下图1.1的②)以udp报文形式与远端服务器bmc进行通信。Dell很多服务器默认是从udp消息是从eth0发出。多网卡情况下,其他网卡能否进行通信根据服务器型号而异,需要进行测试。多网卡绑定的情况则要求每个独立的网卡都可以与远端的bmc通信。 (监控端)应用软件---------------->网卡(udp)----------------->bmc(被监控端)![]() [root@18034 ~]# service ipmi start // 先启动ipmi Starting ipmi drivers: [确定] [root@18034 ~]# ipmitool -I open mc info // 先查看下ipmi版本,是2.0没错. Device ID : 32 Device Revision : 0 Firmware Revision : 1.10 IPMI Version : 2.0 Manufacturer ID : 674 Manufacturer Name : DELL Inc Product ID : 256 (0x0100) [root@18034 ~]# ipmitool -I open channel info 1 // 查看通道信息,dell机型基本默认采用channel1,其它机型则不一定.一般在1-7之间。 Channel 0x1 info: Channel Medium Type : 802.3 LAN // 表示可以使用的通道,channel 1 Channel Protocol Type : IPMB-1.0 Session Support : multi-session Active Session Count : 0 Protocol Vendor ID : 7154 Volatile(active) Settings Alerting : disabled Per-message Auth : disabled UserLevel Auth : enabled Access Mode : disabled Non-Volatile Settings Alerting : disabled Per-message Auth : disabled UserLevel Auth : enabled Access Mode : disabled [root@18034 ~]# ipmitool -I open channel info 2 // 看看其它channel?,就没有802.3 lan类型 Channel 0x2 info: Channel Medium Type : Serial/Modem Channel Protocol Type : IPMB-1.0 Session Support : single-session Active Session Count : 0 Protocol Vendor ID : 7154 (2)设置BMC ip,作为远程管理ip[root@18034 ~]# ipmitool lan set 1 ipaddr 192.168.180.201 // 1 代表channel Setting LAN IP Address to 192.168.180.201 [root@18034 ~]# ipmitool lan set 1 netmask 255.255.255.0 Setting LAN Subnet Mask to 255.255.255.0 [root@18034 ~]# ipmitool lan set 1 defgw ipaddr 192.168.180.34 Setting LAN Default Gateway IP to 192.168.180.34 注:IP网段可选,不一定跟主机一个网段,只要监控端和被监控端可通信,监控端有和被监控端bmc同一网段ip即可。网关可设可不设,若设置则设置成物理网卡ip,一般是eth0ip[root@18034 ~]# ipmitool lan print 1 // 查看channel 1的配置信息 Setin Progress : Set Complete Auth Type Support : NONE MD2 MD5 PASSWORD Auth Type Enable : Callback : MD2 MD5 : User : MD2 MD5 : Operator : MD2 MD5 : Admin : MD2 MD5 : OEM : MD2 MD5 IP Address Source : Static Address IP Address : 192.168.180.201 Subnet Mask : 255.255.255.0 MAC Address : 00:24:e8:74:0b:ad SNMP Community String : public IP Header : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10 Default Gateway IP : 192.168.180.34 Default Gateway MAC : 00:00:00:00:00:00 Backup Gateway IP : 0.0.0.0 Backup Gateway MAC : 00:00:00:00:00:00 802.1q VLAN ID : Disabled 802.1q VLAN Priority : 0 RMCP+ Cipher Suites : 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 Cipher Suite Priv Max : aaaaaaaaaaaaaaa : X=Cipher Suite Unused : c=CALLBACK : u=USER : o=OPERATOR : a=ADMIN : O=OEM (3)创建用户名和密码,并给管理权限[root@18034 ~]# ipmitool usersetname 2 root //创建用户 [root@18034 ~]# ipmitool usersetpassword 2 opendoor //创建密码 [root@18034 ~]# ipmitool channel setaccess 1 2 callin=on ipi=on link=on privilege=4 //开权限 [root@18034 ~]# ipmitool user list 1 // 查看chanenel 1的用户信息 ID Name Callin Link Auth IPMI Msg Channel Priv Limit 2 root truetruetrue ADMINISTRATOR 注:dell很多机型user list 里面 默认 id 1 的用户默认为空,或者不能设置。 通常设置id 2 为root 用户,其他厂商机型 id 2用户可能已经设置如 Admin,并且不能更改,这时只能用给定的账号进行远程管理,或者id 3 再创建账号,同上。 如果是用id 2 之外,如id 3等账号,在进行sol远程屏幕管理是,需要再敲一条指令,激活sol功能,不然会提示错误。ipmitool sol payload enable 1 3// 1是channel 信息,3 是user id2.4ipmitool获取远程服务器信息(1)过程概述 ipmitool命令需要通过相应的interface来访问BMC,在本地获取信息时候采用的是-I open,即为OpenIPMI接口,IPMItool命令包含的接口有open、lan、lanplus。其中open是指的是OpenIPMI与BMC通信,lan是通过Ethernet LAN request/resoponse消息,消息具有一个IPMI session头和RMCP头。采用IPV4的udp协议与BMC通信。UDP的数据段包含了IPMI 。IPMI使用Remote Management Control Protocol (RMCP) 版本1支持操作系统关闭(pre-OS和OS-absent),RMCP把把数据发送到UDP的623端口。像lan接口一样,lanplus同样使用Ethernet LAN的UDP协议与BMC通信,但是lanplus使用rmcp+协议(在IPMIV2.0中描述)来通信,RMCP+允许使用改经的认证方式和数据完整性检查。Open端口用于本地监控系统使用的,lan/lanplus通过网络进行远程监控。远程获取服务器监控信息时,需要加上远程服务器的地址, 使用以下的命令格式:ipmitool -H 192.168.180.201 -U root -P opendoor -I lan command 其中-H表示后面跟的是服务器的地址,-U表示后面跟着用户名,-P表示后面跟着用户密码,command与本地获取信息相同。(2)远程重启[root@161 ~]# ipmitool -I open -H 192.168.180.201 -U root -P opendoorc power status //检查远程服务器bmc 状态 Chassis Power ison [root@161 ~]# ipmitool -I open -H 192.168.180.201 -U root -P opendoor power ? chassis power Commands: status, on, off, cycle, reset, diag, soft 注: ?代表可填上面几条指令, on/off/reset 开机/关机/重启 ipmitool -I open -H 192.168.180.201 -U root -P opendoor sensor // 这条可获取远端服务器的一些传感器信息,包含 cpu,电压,功率等 (3)远程屏幕1.grub.conf文件修改[root@18034 ~]# cat /boot/grub/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relativeto /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=10 #splashp_w_picpath=(hd0,0)/grub/splash.xpm.gz serial --unit=0 --speed=57600 terminal --timeout=10 hiddenmenu title #CentOS (2.6.18-308.20.1.el5debug) root (hd0,0) kernel /vmlinuz-2.6.18-308.20.1.el5debug ro root=/dev/VolGroup00/LogVol00 console=tty0 console=tty S0,57600 initrd /initrd-2.6.18-308.20.1.el5debug.img 注:grub.conf 文件主要修改的地方,如标记所示。default=0 代表内核数,从0开始,即为1个内核timeout=10 默认值为5,开机grub界面提示为5秒。这里建议调大,因为远程屏幕有时候避免不了一些delay.#splashp_w_picpath=(hd0,0)/grub/splash.xpm.gz 屏蔽掉图形界面,串口重定向,只能是文本信息kernel /vmlinuz-2.6.18-308.20.1.el5debug ro root=/dev/VolGroup00/LogVol00 console=tty0 console=tty S0,57600 参数传递到内核中,实现串口重定向console=tty0 代表显示器输出 console=tty S0 代表定向到串口1 ,如果是 tty S1 代表定向到串口257600 则为串口通信采用的波特率,波特率和bios设置的一样,经测试,57600的波特率在 sol屏幕输出比较稳定,不容易出现乱码,进程挂起之类。2.securetty 文件修改[root@18034 ~]# grep tty /etc/securetty tty1 tty2 tty3 tty4 tty5 tty6 tty7 tty8 tty9 tty10 tty11 ttyS0 // 添加grub.conf 里kernel 后面跟的串口信息,为了屏幕信息可以从串口输出 3.inittab 文件修改[root@18034 ~]# grep -v "#" /etc/inittab id:3:initdefault: si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 ca::ctrlaltdel:/sbin/shutdown -t3 -r now pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" S0:2345:respawn:/sbin/agetty -h -L 57600 ttyS0 vt100 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 注:id:3:initdefault: 3代表文本显示,因为只能重定向文本,所以不能选择5-X11S0:2345:respawn:/sbin/agetty -h -L 57600 ttyS0 vt100 为了显示登录系统的界面(4)sol指令[root@161 ~]# ipmitool -I lanplus -H 192.168.180.201 -U root -P opendoor sol activate 下图为成功远程重启,Xshell终端看到的信息![]() 上一篇:shell 特殊符号集锦 下一篇:PHP工作环境搭建 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |